﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using DTO;
using BusinessLogic;

namespace Presentation.Content
{
    public partial class cursesPanel : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                mvSearchCourses.ActiveViewIndex = -1;
                mvMain.ActiveViewIndex = -1;
                mvAddTeacherStudents.ActiveViewIndex = -1;
                mvButtons.ActiveViewIndex = -1;
                mvSearchbox.ActiveViewIndex = -1;
            }
        }

        

        

        protected void gvCourses_SelectedIndexChanged1(object sender, EventArgs e)
        {
            mvMain.ActiveViewIndex = 0;
            mvAddTeacherStudents.ActiveViewIndex = 0;

            if (e.Equals("Delete"))
            { 
                
            }
            else if(e.Equals("Select"))
            {
            }
        }

        protected void ddlMain_SelectedIndexChanged1(object sender, EventArgs e)
        {
            if (ddlMain.SelectedValue.Equals("New"))
            {
                mvSearchCourses.ActiveViewIndex = -1;
                mvMain.ActiveViewIndex = 0;
                mvSearchbox.ActiveViewIndex = 0;
                mvAddTeacherStudents.ActiveViewIndex = 1;
                mvActionStudent.ActiveViewIndex = -1;
                mvButtons.ActiveViewIndex = 1;
            }
            else if (ddlMain.SelectedValue.Equals("Modify"))
            {
                mvSearchCourses.ActiveViewIndex = 0;
                mvMain.ActiveViewIndex = -1;
                mvAddTeacherStudents.ActiveViewIndex = -1;
                mvSearchbox.ActiveViewIndex = -1;
                mvButtons.ActiveViewIndex = -1;
            }
            else if (ddlMain.SelectedValue.Equals("AddInscription"))
            {
                mvSearchCourses.ActiveViewIndex = 0;
                mvMain.ActiveViewIndex = -1;
                mvAddTeacherStudents.ActiveViewIndex = -1;
                mvActionStudent.ActiveViewIndex = 0;
                mvSearchbox.ActiveViewIndex = -1;
                mvButtons.ActiveViewIndex = -1;
            }
            else
            {
                mvSearchCourses.ActiveViewIndex = -1;
                mvMain.ActiveViewIndex = -1;
                mvAddTeacherStudents.ActiveViewIndex = -1;
                mvButtons.ActiveViewIndex = -1;
                mvActionStudent.ActiveViewIndex = -1;
                mvSearchbox.ActiveViewIndex = -1;
            }
        }

        protected void btnSearchCourse_Click(object sender, EventArgs e)
        {

        }

        protected void btnSearchStuTeacher_Click(object sender, EventArgs e)
        {
            
        }

        //Llena el formulario con los datos de un curso.
        private void fillForm(Course c)
        {
            lblNroId.Text = c.LngId.ToString();
            txtCourseName.Text = c.StrName.ToString();
            txtPlace.Text = c.StrPlace.ToString();
            txtPrice.Text = c.FltPrice.ToString();
            txtDesc.Text = c.StrDescription.ToString();
            lblTeacher.Text = c.TchTeacher.StrFstName.ToString() + " " + c.TchTeacher.StrFstSurname.ToString();
            //lblClassCount.Text = 
        }
    }
}